package cn.tedu.dimanage.show.webapi.controller;

import cn.tedu.dimanage.common.web.JsonResult;
import cn.tedu.dimanage.pojo.dto.ShowDTO;
import cn.tedu.dimanage.pojo.vo.ShowVO;
import cn.tedu.dimanage.show.service.IShowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping(value = "/show" , produces = "application/json;charset=utf-8")
public class ShowController{

    @Autowired
    private IShowService service;

    @RequestMapping("/add-new")
    public JsonResult<Void> addNew(ShowDTO showDTO) {
        service.addNew(showDTO);
        return JsonResult.ok();
    }

    @RequestMapping("/selectList")
    public JsonResult<List<ShowVO>> selectList() {
        List<ShowVO> showVOS = service.selectList();
        return JsonResult.ok(showVOS);
    }

    @RequestMapping("deleteById")
    public JsonResult<Void> deleteById(Long id) {
        service.deleteById(id);
        return JsonResult.ok();
    }

}
